<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" isELIgnored="false"%>

<html>
<head>
    <title>学生列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 引入 Bootstrap -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">

    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>
                    <small>学生列表 —— 显示所有学生</small>
                </h1>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-4 column">
            <a class="btn btn-primary" href="${pageContext.request.contextPath}/index.jsp">首页</a>
            <a class="btn btn-primary" href="${pageContext.request.contextPath}/stu/toAddstu">添加学生</a>
            <a class="btn btn-primary" href="${pageContext.request.contextPath}/stu/allstu">显示全部学生</a>
        </div>

        <%--通过姓名查询--%>
        <div class="col-md-8column">
            <form class="form-inline" action="${pageContext.request.contextPath}/stu/querystu" method="post"
                  style="float: right">
                <span style="color: red;font-weight: bold">${error}</span>
                <input type="text" name="name" class="form-control" placeholder="请输入要查询的学生名字">
                <input type="submit" value="查询" class="btn btn-primary">
            </form>
        </div><br><br><br>

        <div class="col-md-8column">
            <form class="form-inline" action="${pageContext.request.contextPath}/stu/querymajor" method="post"
                  style="float: right">
                <span style="color: red;font-weight: bold">${error}</span>
                <input type="text" name="major" class="form-control" placeholder="请输入要查询的学生专业">
                <input type="submit" value="查询" class="btn btn-primary">
            </form>
        </div><br><br><br>

        <div class="col-md-8column">
            <form class="form-inline" action="${pageContext.request.contextPath}/stu/querysid" method="post"
                  style="float: right">
                <span style="color: red;font-weight: bold">${error}</span>
                <input type="text" name="sid" class="form-control" placeholder="请输入要查询的学生学号">
                <input type="submit" value="查询" class="btn btn-primary">
            </form>
        </div>

    </div>

    <div class="row">


    </div>

    <div class="row clearfix">
        <div class="col-md-12 column">
            <table class="table table-hover table-striped">
                <thead>
                <tr>
                    <th>学生序号</th>
                    <th>学生名字</th>
                    <th>学生学号</th>
                    <th>学生专业</th>
                    <th>学生班级</th>
                    <th>学生年龄</th>
                    <th>学生性别</th>

                </tr>
                </thead>

                <tbody>
                <c:forEach var="Stu" items="${list}">
                    <tr>
                        <td>${Stu.getId()}</td>
                        <td>${Stu.getName()}</td>
                        <td>${Stu.getSid()}</td>
                        <td>${Stu.getMajor()}</td>
                        <td>${Stu.getCla()}</td>
                        <td>${Stu.getAge()}</td>
                        <td>${Stu.getSex()}</td>
                        <td>
                            <a href="${pageContext.request.contextPath}/stu/toUpdatestu?id=${Stu.getId()}">更改</a>
                            |
                            <a href="${pageContext.request.contextPath}/stu/del/${Stu.getId()}">删除</a>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div>
</div>